import api from '../api'

export const SET_COMMON_PROPS_PENDING = 'SET_COMMON_PROPS_PENDING';
export const SET_COMMON_PROPS_SUCCESS = 'SET_COMMON_PROPS_SUCCESS';
export const SET_COMMON_PROPS_ERROR = 'SET_COMMON_PROPS_ERROR';
export const REMOVE_COMMON_PENDING = 'REMOVE_COMMON_PENDING';
export const REMOVE_COMMON_SUCCESS = 'REMOVE_COMMON_SUCCESS';
export const REMOVE_COMMON_ERROR = 'REMOVE_COMMON_ERROR';


// 设置一个公共的变量
export function setCommonProps(key,value) {
    return {
        type: 'SET_COMMON_PROPS',
        payload: {
          promise: new Promise((r,j) => {
            r({
              key:key,
              value:value
            });
          })
        }
    }
}

export function removeAllProps() {
  return {
      type: 'REMOVE_COMMON',
      payload: {
        promise: new Promise((r,j) => {
          r({
            removeAll:true
          });
        })
      }
  }
}